//
//  KBHomeTitleButton.swift
//  KimboWeiBoSwift
//
//  Created by kimbo on 15/12/20.
//  Copyright © 2015年 kimbo. All rights reserved.
//

import UIKit

class KBHomeTitleButton: UIButton {
    
    init(title: String, imageName: String) {
        super.init(frame: CGRectZero)
        
        setTitle(title, forState: UIControlState.Normal)
        setImage(UIImage(named: imageName), forState: UIControlState.Normal)
        setTitleColor(UIColor.blackColor(), forState: UIControlState.Normal)
        sizeToFit() //尺寸
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    override func layoutSubviews() {
        super.layoutSubviews()
        
        titleLabel?.frame.origin.x = 0
        
        imageView?.frame.origin.x = titleLabel!.frame.width + 3
    }

}
